const mongoose = require('mongoose')
const baseModel = require('./base-model')
const schema = new mongoose.Schema({
  ...baseModel,
  title: {
    type: String,
    required: true
  },
  //封面图
  cover: {
    type: String, //URL
    default: `images/news-cover.jpg`
  },
  content: {
    type: String,
    required: true
  },
  author: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'User',
    required: true
  }
})

module.exports = mongoose.model('News', schema)
